package com.lbm.business.service.impl;

import java.util.List;
import com.lbm.baseclass.exception.ServiceException;
import com.lbm.baseclass.service.impl.BaseServiceImpl;
import com.lbm.business.service.IUserInfoService;
import com.lbm.model.UserInfo;

public class UserInfoServiceImpl  extends BaseServiceImpl implements IUserInfoService{
	/**
	 * 通过HQL构造查询条件来查询符合条件的Userinfo信息
	 * 
	 * @param hql
	 * @return List
	 * @throws DataAccessException
	 */
	@Override
	public List getUserinfoByHQL(String hql) throws ServiceException {
		return baseDAO.getValueObjectsByHQL(hql);
	}
	/**
	 * 根据主键查询Userinfo信息明细
	 * 
	 * @param id
	 * @throws DataAccessException
	 */
	@Override
	public UserInfo getUserinfoById(String id) throws ServiceException {
		UserInfo userinfo=null;
		List list=baseDAO.getValueObjectsByHQL(" from UserInfo where userid='"+id+"'");
		if(!list.isEmpty()&&list.size()>0){
			userinfo=(UserInfo)list.get(0);
		}
		return userinfo;
	}
	/**
	 * 查询所有的Userinfo信息
	 * 
	 * @param hql
	 * @return List
	 * @throws DataAccessException
	 */
	@Override
	public List getAllUserinfo() throws ServiceException {
		return baseDAO.getValueObjectsByHQL(" from UserInfo");
	}
	/**
	 * 新增、修改Userinfo信息
	 * 
	 * @param Userinfo
	 * @throws DataAccessException
	 */
	@Override
	public void saveOrUpdateUserinfo(UserInfo userinfo) throws ServiceException {
		baseDAO.saveOrUpdateVO(userinfo);
	}
	/**
	 * 删除Userinfo信息
	 * 
	 * @param id
	 * @throws DataAccessException
	 */
	@Override
	public void deleteUserinfo(String id) throws ServiceException {
		UserInfo userinfo=this.getUserinfoById(id);
		baseDAO.deleteVO(userinfo);
	}
}
